const netWorked = require('../../../utils/netWork.js')
const Config = require('../../../utils/confing.js')
// pages/Archives/Supplier/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
      data:[],
      data0:[],
    show:false,
  },
  // 关闭详细页面
  hide: function (e) {
    this.setData({
      show: false,
    })
  },
  // 打开详细页面
  show: function (e) {
    let _this = this
   
    //console.log(e.currentTarget.dataset.supcust_no);
    this.setData({
      show: true,
    })
    _this.setData({
      data0: []
    })
    let id = e.currentTarget.dataset.supcust_no
    console.log(id);

    let where = " supcust_no='" + id + "'";

    wx.request({
      url: Config.BaseUrl + 'Archives/SelGongYin?where=' + where,
      method: "POST",
      //data: where=where,
      success: function (res) {
        // console.log(res.data)
       
        _this.setData({
          data0: res.data[0]
        })
        console.log(_this.data.data0)
      }
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var _this = this;
    netWorked.netWork({
      url: 'Archives/SelGongYin',
      method: "POST",
    
      success: function (res) {
       
        let data = res.data
        _this.setData({
          data: res.data
        })
      }
    })
  },
  //搜索
  onSearch(e) {
    console.log('123');
    let where = "supcust_no like '" + e.detail + "%25' or sup_name like '%25" + e.detail + "%25'";
    let _this = this
    netWorked.netWork({
      url: 'Archives/SelGongYin?where=' + where,
      method: "POST",
      success: function (res) {
        console.log(res.data)
        let data = res.data
        _this.setData({
          data: res.data
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})